﻿@model FriendAD.Core.Ad

@{
    ViewBag.Title = "添加广告";
}
<div class="blank10"></div>
@using (Html.BeginForm("add", "ad", FormMethod.Post, new { name = "addform", enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    <dl class="clearfix">
        <dd>广告标题：</dd>
        <dd>
            @Html.TextBoxFor(mod => mod.Title, new { @class="input_txt", placeholder = "请输入广告标题" ,style="height:50px"})
        </dd>
    </dl>
    <dd>
        <div style='margin-left:8px; margin-top:-5px; margin-right:10px; font-size:13px; color:#FF7F00;'>说明：此标题不会在前台显示，仅用做自己区分广告内容。</div>
    </dd>
    <dl class="clearfix">
        <dd>广告链接：（必须包含：http://）</dd>
        <dd>
            @Html.TextBoxFor(mod => mod.Link, new { @class="input_txt",style="height:50px"})
        </dd>
    </dl>
    <dl class="clearfix">
        <dd>联系电话：</dd>
        <dd>
            @Html.TextBoxFor(mod => mod.tell, new { @class="input_txt", placeholder = "请输入联系电话",style="htight:50px"})
        </dd>
    </dl>
    <dd>
        <div style='margin-left:8px; margin-top:-5px; margin-right:10px; font-size:13px; color:#FF7F00;'>说明：不方便的情况下可以不填写电话号码。</div>
    </dd>

    <dl class="clearfix">
        <dd>广告图片：<span style="font-size:13px; color:#666;">(尺寸：650像素*100像素)</span></dd>
        <dd>
            <input type="file" class="input_txt" placeholder="选择上传广告图片" onchange="imgCheck(files)" name="Img" style="width: 100%;height: 50px;box-sizing: border-box;padding: 14px;color: #696969;font-size: 12px;line-height: 12px;border: #e6e6e6 1px solid;
background: #fff;">
        </dd>
        @Html.ValidationMessageFor(mod=>mod.Img,"", new { style = "margin-left:8px; margin-top:-10px; margin-right:10px;  font-size:13px; color:#FF7F00;" })
    </dl>
    <dd>
        <div style='margin-left:8px; margin-top:-10px; margin-right:10px;  font-size:13px; color:#FF7F00;'>说明：建议电脑端设计广告图片，找专业人士最好，广告图片的质量直接影响广告投放效果，注意图片尺寸。</div>
    </dd>
    <div class="btn_box">
        <div class="blank10" style="margin-bottom:10px;"></div>
        <center>
            <input type="button" name="signup" class="button" value="广告在线制作" onClick="window.open('http://xiuxiu.web.meitu.com/main.html');" style="width:40%;height:30px;line-height:30px">
        </center>
    </div>
    <dl class="clearfix">
        <dd>二维码：<span style="font-size:13px; color:#666;">(尺寸：258像素*258像素)</span></dd>
        <dd>
            <input type="file" class="input_txt" placeholder="选择上传二维码图片" name="qrcode" style="width: 100%;height: 50px;box-sizing: border-box;padding: 14px;color: #696969;font-size: 12px;line-height: 12px;border: #e6e6e6 1px solid;
background: #fff;">
        </dd>
    </dl>
    <dd>
        <div style='margin-left:8px; margin-top:-10px; margin-right:10px;  font-size:13px; color:#FF7F00;'>说明：建议电脑端设计广告图片，找专业人士最好，广告图片的质量直接影响广告投放效果，注意图片尺寸。</div>
    </dd>
    <div class="btn_box">
        <div class="blank10" style="margin-bottom:10px;"></div>
        <center>
            <input type="button" name="signup" class="button" value="二维码在线制作" onClick="window.open('http://cli.im');" style="width:40%;height:30px;line-height:30px">
        </center>
    </div>
    <div class="blank10" style="margin-bottom:15px;"></div>
    <div class="btn_box" style="margin-bottom:50px;">
        <input  class="button" value="确认提交" onclick="return postcheck();">
    </div>
    <div class="blank10"></div>



}
<script type="text/javascript">
    var imgflag = false;
    function imgCheck(files)
    {
        var file = files[0];
        var size = 900;
        var imageReg = /^image\/*/;
        if (!imageReg.test(file.type)) {
            alert("请选择合适的图片格式");
            return false;
        } else {
            imgflag = true;
        }

    }
    function postcheck() {
        if (document.addform.Title.value == "") {
            alert('请填写广告标题！');
            document.addform.adtitle.focus();
            return false;
        }
        if (document.addform.Link.value == "") {
            alert('请填写广告链接！');
            document.addform.adlink.focus();
            return false;
        }

        if (document.addform.Img.value == "") {
            alert('请上传广告图片！');
            document.addform.upfile.focus();
            return false;
        }
        if (!imgflag) {
            alert("请选择合适图片格式");
            return false;
        }
        document.addform.submit();
        return true;
    }
</script>